/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: WHY
 * Date: 2022-10-09
 * Time: 20:31
 */
import java.util.Scanner;
//2022.10.9笔试强训编程题第一

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int a = scanner.nextInt();
        System.out.println("请输入一个整数" + a);
        int[] arr = new int[3 * a];
        int ret1 =0;
        System.out.println("请输入一组个数为3*a的整数");
        while (a != 0) {
            if (a % 2 == 0) {
                for (int i = 0; i < arr.length; i++) {
                    for (int j = 0; j < arr.length - i - 1; j++) {
                        if (arr[j] > arr[j + 1]) {
                            int tmp = arr[j];
                            arr[j] = arr[j + 1];
                            arr[j + 1] = tmp;
                        }
                    }
                    ret1 = arr[arr.length / 2] + arr[arr.length / 2 + 1];
                    if (a % 2 != 0) {
                        for (int e = 0; e < arr.length; e++) {
                            for (int h = 0; h < arr.length - e - 1; h++) {
                                if (arr[h] > arr[h + 1]) {
                                    int tmp = arr[h];
                                    arr[h] = arr[h + 1];
                                    arr[h + 1] = tmp;
                                }

                            }
                            ret1 = arr[arr.length / 2 + 1];

                        }
                    }
                }


            }

        }
        System.out.println(ret1);

    }
}
